package com.night.xjh.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.night.common.entity.xjh.HiddenTrouble;
import com.night.xjh.mapper.HiddenTroubleMapper;
import com.night.xjh.service.HiddenTroubleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName: HiddenTroubleServiceImpl
 * @Description: //TODO
 * @author: xjh
 * @date: 2022/10/21-16:24
 * @version: v1.0
 */
@Service
public class HiddenTroubleServiceImpl implements HiddenTroubleService {
    @Resource
    private HiddenTroubleMapper hiddenTroubleMapper;
    public void add(HiddenTrouble hiddenTrouble) {
        hiddenTroubleMapper.add(hiddenTrouble);
    }

    public void update(HiddenTrouble hiddenTrouble) {
        hiddenTroubleMapper.update(hiddenTrouble);
    }

    public PageInfo<HiddenTrouble> getAll(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<HiddenTrouble> list=hiddenTroubleMapper.getAll();
        return new PageInfo<HiddenTrouble>(list);
    }

    public HiddenTrouble getById(int id) {
        return hiddenTroubleMapper.getById(id);
    }

    public PageInfo<HiddenTrouble> getByCondition(HiddenTrouble hiddenTrouble, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<HiddenTrouble> list=hiddenTroubleMapper.getByCondition(hiddenTrouble);
        return new PageInfo<HiddenTrouble>(list);
    }
}
